<template>
    <div>
      <el-dialog 
         :visible.sync="visible" 
         :title="titleMenu"
         :close-on-click-modal="false"
          append-to-body
          top="10vh"
          :close-on-press-escape="false"
         >
          <el-form :model="form">
            <el-form-item label="分类">
              <el-input v-model="form.id"></el-input>
            </el-form-item>
            <el-form-item label="排序值">
              <el-input v-model="form.type"></el-input>
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button @click="visible = false">取 消</el-button>
            <el-button type="primary" @click="save()">确 定</el-button>
          </div>
      </el-dialog>
    </div>
  </template>
  
  <script>
  export default {
    props:{
      titleMenu:{
          type:String,
          required:true,
      },
      tableData3:{
        type:Array,
      },
      // id:{
      //   type:Number,
      // }
    },
  data(){
      return {
          form: {
              id: "",
              type:'',
          },
          visible:false,
      }
    },
    methods:{
      save(){
        if(this.titleMenu === "菜单的新增"){
          let data = {id:14859,parentId:11111,name:this.form.id,type:this.form.type,size:null,date:"2021-10-5"}
          console.log(data,"data添加的数据");
          this.tableData3.push(data);
          this.form.id = "";
          this.form.type="";
          this.visible = false
        }else if(this.titleMenu === "菜单的修改"){
          this.visible = false
        }
      },
      async initAdd() {
        this.visible = true
      },
    }
  }
  </script>
  
  <style>
  
  </style>